﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;

namespace DAL
{
    /// <summary>
    /// DAL to Status table
    /// </summary>
    public abstract class StatusDAL : BaseDAL, UTL.IBaseDAL
    {
        #region Contansts
        #endregion

        #region Objects
        #endregion

        #region Properties
        #endregion

        #region Constructors
        public StatusDAL() { }
        public StatusDAL(string connectString) : base(connectString) { }
        #endregion

        #region Implements
        /// <summary>
        /// Count all of records
        /// </summary>
        /// <returns>Number of records</returns>
        public int Count()
        {
            return _mdb.tb_Status.Count();
        }

        /// <summary>
        /// Select all data from table in database
        /// </summary>
        /// <returns>Data</returns>
        public DataTable Select()
        {
            try
            {
                var res = from s in _mdb.tb_Status
                          orderby s.Id
                          select new
                          {
                              s.Id,
                              s.Name,
                          };
                return res.ToDataTable();
            }
            catch { return _dtb; }
        }

        /// <summary>
        /// Select data by object from table in database
        /// </summary>
        /// <param name="obj">Condition</param>
        /// <returns>Data</returns>
        public DataTable Select(object obj)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Get a object by key
        /// </summary>
        /// <param name="key">Key need to get</param>
        /// <returns>Object</returns>
        public object GetByKey(object key)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Delete data by id
        /// </summary>
        /// <param name="id">Id</param>
        /// <returns>True is successfull else false</returns>
        public UTL.Session.PerState Delete(long id)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Insert object to table in database
        /// </summary>
        /// <param name="obj">Object need to insert</param>
        /// <returns>True is successfull else false</returns>
        public UTL.Session.PerState Insert(object obj)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Update object to table in database
        /// </summary>
        /// <param name="obj">Object need to update</param>
        /// <returns>True is successfull else false</returns>
        public UTL.Session.PerState Update(object obj)
        {
            throw new NotImplementedException();
        }
        #endregion

        #region Events
        #endregion

        #region Methods
        #endregion

        #region Overrides
        #endregion

        #region Statics
        #endregion

        #region More
        #endregion
    }
}